package itheima.com.Day14.myConntDownLatch;

import java.util.concurrent.CountDownLatch;

public class Chile1 extends Thread {
    private CountDownLatch countDownLatch;

    public Chile1(CountDownLatch countDownLatch) {
        this.countDownLatch = countDownLatch;
    }

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(getName()+"在吃第" + i + "个饺子");
        }
        //相当于计时器，每个孩子吃完就减一
        countDownLatch.countDown();
    }
}
